package com.flash.InventoryManagement.mapper;

import com.flash.InventoryManagement.entity.CashStock;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

/**
 * @author jr
 * @version 1.0
 * @date 2022/8/22
 */
@Mapper
public interface CashStockMapper {

    @Select("select count(*) from cashStock")
    public int countCashStock();

    @Select("select c.* ,c2.accountName from (select rownum rn,c.* from cashStock c) c "+
            "join cash c2 on c.cashId = c2.cashId "+
            "where 1=1 ${strWhere} and rn between #{page} and #{limit}")
    public List<CashStock> selectCashStock(Map map);


    @Insert("insert into cashStock values(#{cashStockId},#{fundId},#{cashId},#{dateCashStock},#{initialState},#{money},#{remark})")
    public int insertCashStock(CashStock cashStock);

    @Delete("delete from cashStock where cashStockId=#{cashStockId}")
    public int deleteCashStock(CashStock cashStock);

    @Update("update cashStock set  fundId=#{fundId},cashId=#{cashId},dateCashStock=#{dateCashStock},initialState=#{initialState},money=#{money},remark=#{remark} where cashStockId=#{cashStockId}")
    public int updateCashStock(CashStock cashStock);




}
